package com.fengshang.wedding.domain.service.api;

import java.util.Collection;

import com.fengshang.wedding.domain.model.api.ITopic;
import com.fengshang.wedding.domain.model.api.VisibilityLevel;

/**
 * 
 *@author gembin@gmail.com
 * 
 */
public interface ITopicManager {
	/**
	 * update a topic which posted by user or guest
	 * @param topic
	 * @return
	 * @throws TopicNotFoundException
	 */
	public ITopic updateTopic(ITopic topic)throws TopicNotFoundException;
	/**
	 * create a new topic for a user
	 * @param userId
	 * @param topic
	 * @throws InvalidTopicException if user is not found
	 */
	public void createTopic(int userId, ITopic topic)throws InvalidTopicException;
	/**
	 * remove a topic
	 * @param topicId
	 * @throws TopicNotFoundException
	 */
	public void removeTopic(int topicId)throws TopicNotFoundException;
	/**
	 * find all the topics owned by a user
	 * @param userId
	 * @param pageSize
	 * @param currentPage
	 * @return Collection of topics
	 */
	public Collection<ITopic> findUserTopicsByPagination(int userId,
			int pageSize, int currentPage);
	/**
	 * query topics		
	 * @param query
	 * @param pageSize
	 * @param currentPage
	 * @return Collection of topics
	 */
	public Collection<ITopic> findTopicsByPagination(String query,
			int pageSize, int currentPage);
	/**
	 * find all the topics which are visible to current user,
	 * but not including the topics posted by the user himself
	 * @param useId
	 * @param pageSize
	 * @param currentPage
	 * @return Collection of topics
	 */
	public Collection<ITopic> findVisibleTopicsByPagination(int userId,int pageSize, int currentPage);
	/**
	 * total pages of topics
	 * @param pageSize
	 * @return total pages
	 */
	public int getTotalPages(int pageSize);
	/**
	 * total pages of topics
	 * @return total pages
	 */
	public int getTotalPages();
	/**
	 * change the VisibilityLevel of a topic
	 * @param topicId
	 * @param level
	 */
	public void updateVisibilityLevel(int topicId,VisibilityLevel level);
	
}
